home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / propModProperties.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  11.4 KB  |  500 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date: Jan 30, 1996
  22. //  Author:        laf
  23. //
  24. //  Description:
  25. //      These procs create the controls for a propMod tool property sheet.
  26. //      See also propModValues.mel for procs that set the state of the
  27. //      property sheet.
  28. //
  29. //
  30. //  Input Arguments:
  31. //      None.
  32. //
  33. //  Return Value:
  34. //      None.
  35. //
  36.  
  37. global proc propModSpaceCallback( int $space )
  38. {
  39.     int $currentMode = eval("propModCtx -q -t " + `currentCtx`); 
  40.     int $newMode;
  41.     int $ws;
  42.  
  43.     if( $space == 1 )
  44.     {    
  45.         // World space
  46.         $newMode = $currentMode - 5;
  47.         $ws = 1;
  48.         radioButtonGrp -e -vis 1 modType3;
  49.     }    
  50.     else
  51.     {
  52.         // Parametric space
  53.         $newMode = $currentMode + 5;
  54.  
  55.         if ($newMode == 10)
  56.         {
  57.             // If we switch from NURBS : World Space to Parametric we're left 
  58.             // in an undefined state, switch to Linear : Parametric
  59.         
  60.             $newMode = 6;
  61.         }
  62.  
  63.         $ws = 0;
  64.         radioButtonGrp -e -vis 0 modType3;
  65.     }    
  66.  
  67.  
  68.     propModCtx -e -t $newMode -ws $ws `currentCtx`; 
  69.     propModDimmer $newMode;
  70. }
  71.  
  72. global proc propModTypeCallback( int $type )
  73. {
  74.     int $currentSpace = eval("propModCtx -q -ws " + `currentCtx`); 
  75.     int $newType;
  76.  
  77.     if( $currentSpace == 1 )
  78.     {
  79.         $newType = $type;
  80.     }    
  81.     else
  82.     {
  83.         $newType = $type + 5;
  84.     }    
  85.  
  86.     propModCtx -e -t $newType `currentCtx`; 
  87.     propModDimmer $newType;
  88. }
  89.  
  90. proc propModSetCallbacks( string $parent )
  91. //
  92. //  Description:
  93. //      Set the callbacks for all of the controls in the dialog.
  94. //      Modifying the context will force propModValues() to be called
  95. //
  96. //
  97. {
  98.     setParent $parent;
  99.  
  100.     radioButtonGrp -e
  101.         -on1 "propModSpaceCallback 1"
  102.         -on2 "propModSpaceCallback 2" modSpace;
  103.  
  104.     radioButtonGrp -e
  105.         -on1 "propModTypeCallback 1"
  106.         -on2 "propModTypeCallback 2" modType;
  107.  
  108.     radioButtonGrp -e
  109.         -on1 "propModTypeCallback 3"
  110.         -on2 "propModTypeCallback 4" modType2;
  111.  
  112.     radioButtonGrp -e
  113.         -on1 "propModTypeCallback 5" modType3;
  114.  
  115.     checkBoxGrp -e
  116.         -on1 "propModDirCheckToVec 0 1"
  117.         -on2 "propModDirCheckToVec 1 1"
  118.         -on3 "propModDirCheckToVec 2 1"
  119.         -of1 "propModDirCheckToVec 0 0"
  120.         -of2 "propModDirCheckToVec 1 0"
  121.         -of3 "propModDirCheckToVec 2 0"
  122.         modDir;
  123.  
  124.     floatSliderGrp -e
  125.         -cc "propModLinearDistToSlope #1"
  126.         linearField;
  127.  
  128.     floatSliderGrp -e
  129.         -cc "propModLinearParamCutoff 0 #1"
  130.         linearFieldU;
  131.  
  132.     floatSliderGrp -e
  133.         -cc "propModLinearParamCutoff 1 #1"
  134.         linearFieldV;
  135.  
  136.     floatSliderGrp -e
  137.         -cc "propModCtx -e -pc #1 `currentCtx`"
  138.         powerCutoff;
  139.  
  140.     floatSliderGrp -e
  141.         -cc "propModPowerCutoff 0 #1"
  142.         powerCutoffU;
  143.  
  144.     floatSliderGrp -e
  145.         -cc "propModPowerCutoff 1 #1"
  146.         powerCutoffV;
  147.  
  148.     floatSliderGrp -e
  149.         -cc "propModCtx -e -pd #1 `currentCtx`"
  150.         powerDegree;
  151.  
  152.     floatSliderGrp -e
  153.         -cc "propModCtx -e -pdp #1 `currentCtx`"
  154.         powerDegreeParam;
  155.  
  156.     textFieldGrp -e
  157.         -cc "propModCtx -e -s #1 `currentCtx`"
  158.         scriptName;
  159.  
  160.     textFieldGrp -e
  161.         -cc "propModCtx -e -sp #1 `currentCtx`"
  162.         scriptNameParam;
  163.  
  164.     textField -edit
  165.         -cc "propModAnimCurveSet \"#1\""
  166.         animCurveName;
  167.  
  168.     textField -edit
  169.         -cc "propModAnimCurveParamSet \"#1\""
  170.         animCurveNameParam;
  171.  
  172.     textField -edit
  173.         -cc "propModCtx -e -nc #1 `currentCtx`"
  174.         nurbsCurveName;
  175. }
  176.  
  177. global proc createAnimCurvesPopup()
  178. {
  179.     global string $gPropModAnimCurvePrefix;
  180.  
  181.     popupMenu -e -dai animCurvePopup;
  182.     setParent -menu animCurvePopup;
  183.  
  184.     string $all[] = `ls ($gPropModAnimCurvePrefix + "*")`;
  185.     string $select = "";
  186.     int $i, $n;
  187.  
  188.     $n = size($all);
  189.  
  190.     if( $n > 0 ) {
  191.         $select = "select -d ";
  192.         for( $i=0; $i<$n; $i+=1 ) {
  193.             $select = $select + ( $all[$i] + " " );
  194.         }
  195.         $select = $select + "; ";
  196.  
  197.         for( $i=0; $i<$n; $i+=1 ) {
  198.             menuItem -l $all[$i]
  199.                 -c ($select + "select -add " + $all[$i] + "; " +
  200.                     "propModAnimCurveSet " + $all[$i] + "; ");
  201.         }
  202.     }
  203.     else {
  204.         menuItem -l ("No anim curves with prefix " + $gPropModAnimCurvePrefix );
  205.     }
  206.     menuItem -d true;
  207.     menuItem -l "Create New"
  208.         -c "propModAnimCurveSet \"\";";
  209. }
  210.  
  211. global proc createAnimCurvesParamPopup()
  212. {
  213.     global string $gPropModAnimCurvePrefix;
  214.  
  215.     popupMenu -e -dai animCurveParamPopup;
  216.     setParent -menu animCurveParamPopup;
  217.  
  218.     string $all[] = `ls ($gPropModAnimCurvePrefix + "*")`;
  219.     string $select = "";
  220.     int $i, $n;
  221.  
  222.     $n = size($all);
  223.  
  224.     if( $n > 0 ) {
  225.         $select = "select -d ";
  226.         for( $i=0; $i<$n; $i+=1 ) {
  227.             $select = $select + ( $all[$i] + " " );
  228.         }
  229.         $select = $select + "; ";
  230.  
  231.         for( $i=0; $i<$n; $i+=1 ) {
  232.             menuItem -l $all[$i]
  233.                 -c ($select + "select -add " + $all[$i] + "; " +
  234.                     "propModAnimCurveParamSet " + $all[$i] + "; ");
  235.         }
  236.     }
  237.     else {
  238.         menuItem -l ("No anim curves with prefix " + $gPropModAnimCurvePrefix );
  239.     }
  240.     menuItem -d true;
  241.     menuItem -l "Create New"
  242.         -c "propModAnimCurveParamSet \"\";";
  243. }
  244.  
  245. global proc createNurbsCurvesPopup()
  246. {
  247.  
  248.     popupMenu -e -dai nurbsCurvePopup;
  249.     setParent -menu nurbsCurvePopup;
  250.  
  251.     string $all[] = `ls -lf -dag -type "nurbsCurve"` ;
  252.     string $select = "";
  253.     int $i, $n;
  254.  
  255.     $n = size($all);
  256.  
  257.     if( $n > 0 ) {
  258.         for( $i=0; $i<$n; $i+=1 ) {
  259.             menuItem -l $all[$i]
  260.                 -c ( "propModNurbsCurveSet " + $all[$i] + "; ");
  261.         }
  262.     }
  263.     else {
  264.         menuItem -l ("No NURBS curves." );
  265.     }
  266. }
  267.  
  268.  
  269. global proc propModProperties()
  270. //
  271. //  Description:
  272. //      This procedure builds the property sheet and assigns callbacks to
  273. //      its controls.  The state of the controls are set in propModValues().
  274. //
  275. //
  276. {
  277.     //    Defined as part of OptionsTemplate in setDefaultTemplates.mel.
  278.     //
  279.     global int $gOptionsTemplateControlAreaWidth;
  280.     global int $gOptionsTemplateExtraWidth;
  281.  
  282.     string $parent = `toolPropertyWindow -q -location`;
  283.  
  284.     setUITemplate -pushTemplate OptionsTemplate;
  285.  
  286.     setParent $parent;
  287.  
  288.     columnLayout propMod;
  289.  
  290.       $parent = `setParent -query`;
  291.       separator -style "none";
  292.  
  293.       radioButtonGrp -nrb 2 -sl 1 -l "Modification Type"
  294.           -l1 "World" -l2 "Parametric(NURBS)"
  295.           modSpace;
  296.  
  297.       radioButtonGrp -nrb 2 -sl 1 -l "Modification Falloff"
  298.           -l1 "Linear" -l2 "Power"
  299.           modType;
  300.       radioButtonGrp -nrb 2 -l ""
  301.           -l1 "Script" -l2 "Curve"
  302.           -scl modType
  303.           modType2;
  304.  
  305.       radioButtonGrp -nrb 1 -l ""
  306.           -l1 "NURBS Curve"
  307.           -scl modType
  308.           modType3;
  309.     
  310.       tabLayout -tabsVisible false propModTypeTabs;
  311.  
  312.         //    Power tab parametric.
  313.         //
  314.         //  ** The tab with the largest number of controls needs to come first, to reserve enough vertical
  315.         //  space in the layout
  316.         //
  317.         columnLayout propModPowerParamTab;
  318.           floatSliderGrp -field true
  319.               -l "Distance Cutoff U"
  320.               -fmn -100.0 -fmx 100.0
  321.               -min 0.01 -max 20.0
  322.               -v 0.5
  323.               -pre 2
  324.               powerCutoffU;
  325.           floatSliderGrp -field true
  326.               -l "Distance Cutoff V"
  327.               -fmn -100.0 -fmx 100.0
  328.               -min 0.01 -max 20.0
  329.               -v 0.5
  330.               -pre 2
  331.               powerCutoffV;
  332.           floatSliderGrp -field true
  333.               -l "Degree"
  334.               -min -5.0 -max 5.0 -v -0.1
  335.               powerDegreeParam;
  336.         setParent ..;
  337.  
  338.  
  339.         //    Power tab.
  340.         //
  341.         columnLayout propModPowerTab;
  342.           floatSliderGrp -field true
  343.               -l "Distance Cutoff"
  344.               -fmn -100.0 -fmx 100.0
  345.               -min 0.01 -max 20.0
  346.               -v -0.1
  347.               -pre 2
  348.               powerCutoff;
  349.  
  350.           floatSliderGrp -field true
  351.               -l "Degree"
  352.               -min -5.0 -max 5.0 -v -0.1
  353.               powerDegree;
  354.         setParent ..;
  355.  
  356.  
  357.         //  Linear tab -- Parametric.
  358.         //
  359.         columnLayout propModLinearParamTab;
  360.           floatSliderGrp -field true
  361.               -l "Distance Cutoff U"
  362.               -fmn 0.0 -fmx 1000.0
  363.               -min 0.0 -max 10.0
  364.                -s 0.05
  365.                -ss 0.05
  366.               -v 0.5
  367.               -pre 2
  368.               linearFieldU;
  369.           floatSliderGrp -field true
  370.               -l "Distance Cutoff V"
  371.               -fmn 0.0 -fmx 1000.0
  372.               -min 0.0 -max 10.0
  373.               -s 0.05
  374.                -ss 0.05
  375.               -v 0.5
  376.               -pre 2
  377.               linearFieldV;
  378.         setParent ..;
  379.  
  380.  
  381.         //    Linear tab.
  382.         //
  383.         columnLayout propModLinearTab;
  384.           floatSliderGrp -field true
  385.               -l "Distance Cutoff"
  386.               -fmn -1000.0 -fmx 1000.0
  387.               -min 0.01 -max 20.0
  388.               -v -0.1
  389.               -pre 2
  390.               linearField;
  391.         setParent ..;
  392.  
  393.  
  394.         //    Script tab - Parametric.
  395.         //
  396.         columnLayout propModScriptParamTab;
  397.           textFieldGrp -l "User Defined Script" scriptNameParam;
  398.         setParent ..;
  399.  
  400.  
  401.         //    Script tab.
  402.         //
  403.         columnLayout propModScriptTab;
  404.           textFieldGrp -l "User Defined Script" scriptName;
  405.         setParent ..;
  406.  
  407.  
  408.         //    Anim curve tab - Parametric.
  409.         //
  410.         columnLayout propModAnimParamTab;
  411.             rowLayout -numberOfColumns 3
  412.                 -columnAttach 3 "left" 0
  413.                 -columnWidth  2 $gOptionsTemplateControlAreaWidth
  414.                 -columnWidth  3 $gOptionsTemplateExtraWidth
  415.                 ;
  416.             text -label "Anim. Curve";
  417.             textField animCurveNameParam;
  418.             symbolButton -image "dropArrow.xpm" -height 22;
  419.             popupMenu -button 1 -postMenuCommand "createAnimCurvesParamPopup"
  420.                 animCurveParamPopup;
  421.             setParent ..;
  422.  
  423.           floatSliderGrp -field true
  424.               -l "Scale U"
  425.               -min 0.0 -max 1.0
  426.               -v 1.0 
  427.               -pre 2
  428.               animParamFieldU;
  429.           floatSliderGrp -field true
  430.               -l "Scale V"
  431.               -min 0.0 -max 1.0
  432.               -v 1.0 
  433.               -pre 2
  434.               animParamFieldV;
  435.         setParent ..;
  436.  
  437.  
  438.         //    Anim curve tab.
  439.         //
  440.         columnLayout propModAnimTab;
  441.         rowLayout -numberOfColumns 3
  442.             -columnAttach 3 "left" 0
  443.             -columnWidth  2 $gOptionsTemplateControlAreaWidth
  444.             -columnWidth  3 $gOptionsTemplateExtraWidth
  445.             ;
  446.         text -label "Anim. Curve";
  447.         textField animCurveName;
  448.         symbolButton -image "dropArrow.xpm" -height 22;
  449.         popupMenu -button 1 -postMenuCommand "createAnimCurvesPopup"
  450.             animCurvePopup;
  451.         setParent ..;
  452.         setParent ..;
  453.  
  454.         //    
  455.         //    NURBS curve tab -- parametric version. This is simply an empty placeholder to clear 
  456.         //  the tab
  457.         //
  458.         columnLayout propModNurbsParamTab;
  459.         setParent ..;
  460.  
  461.  
  462.         //    NURBS curve tab (there is no parametric version).
  463.         //
  464.         columnLayout propModNurbsTab;
  465.         rowLayout -numberOfColumns 3
  466.             -columnAttach 3 "left" 0
  467.             -columnWidth  2 $gOptionsTemplateControlAreaWidth
  468.             -columnWidth  3 $gOptionsTemplateExtraWidth
  469.             ;
  470.         text -label "NURBS Curve";
  471.         textField nurbsCurveName;
  472.         symbolButton -image "dropArrow.xpm" -height 22;
  473.         popupMenu -button 1 -postMenuCommand "createNurbsCurvesPopup"
  474.             nurbsCurvePopup;
  475.         setParent ..;
  476.         setParent ..;
  477.  
  478.  
  479.       setParent ..;
  480.  
  481.       tabLayout -tabsVisible false propModDirTabs;
  482.         columnLayout propModDirVis;
  483.           checkBoxGrp -ncb 3 -l "Distance Based On"
  484.               -l1 "X" -l2 "Y" -l3 "Z"
  485.               -v1 on -v2 on -v3 on
  486.               modDir;
  487.         setParent ..;
  488.         columnLayout propModDirInvis;
  489.         setParent ..;
  490.       setParent ..;
  491.  
  492.  
  493.     setParent ..; // propMod
  494.  
  495.     setUITemplate -popTemplate;
  496.  
  497.     propModSetCallbacks( $parent );
  498. }
  499.  
  500.